//
//  YXHTTPManager.h
//  YXEDU
//
//  Created by shiji on 2018/3/16.
//  Copyright © 2018年 shiji. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface BSHTTPManager : NSObject

+ (instancetype) shared;

// 
@property (nonatomic, strong) NSMutableDictionary *headParams;

@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;

@property (nonatomic, assign) NSTimeInterval timeoutInterval;

@property (nonatomic, strong) NSSet *acceptableContentTypes;

// POST
- (void)POST:(NSString *)URLString headerParams:(id)headerParams parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

- (void)POST:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

- (void)POST:(NSString *)URLString success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

// GET
- (void)GET:(NSString *)URLString headerParams:(id)headerParams parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

- (void)GET:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

- (void)GET:(NSString *)URLString success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure;

//
- (void)DOWNLOAD:(NSString *)URLString fileLength:(NSInteger)length progress:(void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destinationBlock completion:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionBlock;

- (void)DOWNLOAD:(NSString *)URLString progress:(void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destinationBlock completion:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionBlock;
@end
